using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Logistica;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DALogistica;

namespace GC2.Bussines.BMLogistica
{
    public class BMHRuta
    {
        public BMHRuta(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        DAHRuta daHRuta = new DAHRuta();
        HRuta oHruta= new HRuta();

        #region BMHRutaProximoID
        public Int64 BMHRutaProximoID()
        {
            Int64 iProximo = 0;
            try
            {
                iProximo = daHRuta .DAHRutaProximoID(Connection);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return iProximo;
        }
        #endregion

        #region BMHRutaInsert
        public void BMHRutaInsert(HRuta hruta)
        {
            try
            {
                daHRuta.DAHRutaInsert(Connection,hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMHRutaGetAll
        public List<HRuta> BMHRutaGetAll(HRuta hrutaD, HRuta hrutaH)
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaGetAll(connection, hrutaD, hrutaH);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaGetOne
        public HRuta BMHRutaGetOne(HRuta hruta)
        {
            try
            {
                hruta = daHRuta.DAHRutaGetOne(connection, hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return hruta;
        }
        #endregion

        #region BMHRutaPendientesGetAll
        public List<HRuta> BMHRutaPendientesGetAll()
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaPendientesGetAll(connection);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaActivasGetAll
        public List<HRuta> BMHRutaActivasGetAll(HRuta hrutaD, HRuta hrutaH)
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaActivasGetAll(connection, hrutaD, hrutaH);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaCerradasGetAll
        public List<HRuta> BMHRutaCerradasGetAll(HRuta hrutaD, HRuta hrutaH)
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaCerradasGetAll(connection, hrutaD, hrutaH);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaEntregarGetAll
        public List<HRuta> BMHRutaEntregarGetAll()
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaEntregarGetAll(Connection);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaImputarGetAll
        public List<HRuta> BMHRutaImputarGetAll()
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaImputarGetAll(Connection);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaUpdate
        public void BMHRutaUpdate(HRuta hruta)
        {
            try
            {
                daHRuta.DAHRutaUpdate(Connection, hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMHRutaUpdateEntregar
        public void BMHRutaUpdateEntregar(HRuta hruta)
        {
            try
            {
                daHRuta.DAHRutaUpdateEntregar(Connection, hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMHRutaUpdateImputar
        public void BMHRutaUpdateImputar(HRuta hruta)
        {
            try
            {
                daHRuta.DAHRutaUpdateImputar(Connection, hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMHRutaUpdateNoModificar
        public void BMHRutaUpdateNoModificar(HRuta hruta)
        {
            try
            {
                daHRuta.DAHRutaUpdateNoModificar(Connection, hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMHRutaGetPaginas
        public List<HRuta> BMHRutaGetPaginas(HRuta hruta)
        {
            List<HRuta> listaHRuta = new List<HRuta>();
            try
            {
                listaHRuta = daHRuta.DAHRutaGetPaginas(Connection,hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return listaHRuta;
        }
        #endregion

        #region BMHRutaDelete
        public void BMHRutaDelete(HRuta hruta)
        {
            try
            {
                daHRuta.DAHRutaDelete(Connection, hruta);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}



